package com.aaa.backsystem.controller;


import com.aaa.backsystem.entity.Dic;
import com.aaa.backsystem.entity.LayuiTable;
import com.aaa.backsystem.service.DicService;
import com.aaa.backsystem.util.MyConstants;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author gyc
 * @since 2020-07-23
 */
@Controller
@RequestMapping("/dic")
public class DicController {

    @Autowired
    private DicService dicService;

    /**
     * 民族下拉框
     **/
    @GetMapping("/notionList")
    @ResponseBody
    public LayuiTable notionList(Integer i){
        Wrapper<Dic> wrapper = new EntityWrapper();
        wrapper.eq("type_id",i);
        List<Dic> dics = dicService.selectList(wrapper);
        LayuiTable layuiTable = new LayuiTable();

        layuiTable.setCode(MyConstants.OPERATION_SUCCESS_CODE);
        layuiTable.setMsg(MyConstants.OPERATION_SUCCESS_MESSAGE);
        layuiTable.setData(dics);
        return layuiTable;
    }




}

